﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GestionePolveri2.DAL;

namespace GestionePolveri2
{
    public partial class PolveriManager_old : Form
    {
        GestionePolveriEntities ctx = null;

        public PolveriManager_old()
        {
            InitializeComponent();
        }

        private void PolveriManager_Load(object sender, EventArgs e)
        {
            ctx = new GestionePolveriEntities();

            //this.polveriBindingSource.DataSource = ((IListSource)ctx.Polveri).GetList(); //ctx.Polveri.ToList();

            //this.polveriBindingSource.DataSource = ctx.Polveri.ToList();

        }

        private void polveriBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            //this.polveriBindingSource.EndEdit();
            //ctx.SaveChanges();

            
            //ctx.Polveri.Where(x => x.IDPolvere == 1).FirstOrDefault().Note = "ciao ciao";
            //ctx.SaveChanges();
        }

        private void polveriBindingSource_AddingNew(object sender, AddingNewEventArgs e)
        {
            //e.NewObject = new DAL.Polveri();

            //ctx.AddObject("GestionePolveriEntities.Polveri", e.NewObject);
            //ctx.AddToPolveri((DAL.Polveri)e.NewObject);
        }

        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            //polveriBindingSource.EndEdit();
            //DAL.Polveri obj = (DAL.Polveri)polveriBindingSource.Current;

            //ctx.SaveChanges();
            //ctx.DeleteObject(polveriBindingSource.Current);
        }

        private void bindingNavigatorDeleteItem_MouseDown(object sender, MouseEventArgs e)
        {
            //DAL.Polveri obj = (DAL.Polveri)polveriBindingSource.Current;
            //ctx.Polveri.DeleteObject(obj);
            ////ctx.SaveChanges();

            //polveriBindingSource.MovePrevious();
        }
    }
}
